date_interval_format
Alias for DateInterval::format - Set the format of intervals
date_interval_format()
function is an alias for DateInterval::format()
.
DateInterval::format()
function is used to format the time interval.
Calculate the interval between two day periods and format the interval:
<?php $date1 = date_create ( "1984-01-28" ) ; $date2 = date_create ( "1980-10-15" ) ; $diff = date_diff ( $date1 , $date2 ) ; // %a Total number of days output echo $diff -> format ( "Total days: %a." ) ; ?>
Try it yourself
DateInterval :: format ( format ) ;
parameter | describe |
---|---|
format |
Required. Specified format. The format parameter string can use the following characters:
Comment: Each format string must be prefixed with the % symbol! |